// import Vue from 'vue'
// import Discourse from 'discourse-js'

// const userApiKey = 'c063b0072f5821c4bff5f33826cd8adc2e756c06657ecd21ff74df7bcf7103b4'
// const apiKey = '9466a351547b848f15e673d83af3c2d69739a688e4ab9da6c994946dad07055e'
// const apiKey = '77d83fa34839f304a65cb4401b20565ba1776a2b125d2fd5952569e89980ffc5'
// const apiUsername = 'Edwin_Zhen'
// const baseUrl = '/discourse'

// const discourse = new Discourse()
// discourse.config({ apiKey, apiUsername, baseUrl })

// export const createPost = params => {
//   return discourse.posts.create(params)
// { ...params, ...{ 'Api-Key': apiKey, 'Api-Username': apiUsername } }
// .create({
// topic_id: 11, // optional (required for creating a new post on a topic.)
// raw: 'Hello World'
// imageUri: imageUri // optional to create a post/topic with an image.
// })
// }

import axios from 'axios'

export const discussion = (params, username) => {
  return axios.request({
    url: `/discourse/posts.json`,
    method: 'post',
    // baseURL: 'https://forum.mspbots.ai',
    headers: {
      'Api-Key': 'e1686a23f989fe75dfe7f9b6a31d5f7761e4e6e8a4ff28046e693a074891cecb',
      'Api-Username': username
    },
    params,
    withCredentials: false
  })
}

export const categories = () => {
  return axios.request({
    url: `/discourse/categories.json`,
    method: 'get',
    withCredentials: false,
    headers: {
      'content-type': 'application/json'
    }
  })
}

// /users/Ken_Lee.json      Use username get user info
// /users                   Create users by name, email, password,
